#include<iostream>
#define MAX 20
void citire(int [],int &);
void afisare(int [],int n);
int prim(int n);
int main()
{
	int n,i,v[MAX],a[MAX],b[MAX];
	citire(v,n);
	std::cout<<"Vectorul dat: ";	
	afisare(v,n);
	std::cout<<"Vectorul cu elem nenule: ";
        for(i=0;i<n;i++)
                if(v[i]!=0)
			a[i]=v[i];
	afisare(a,n);
	std::cout<<"\nVectorul cu elem prime: ";
	for(i=0;i<n;i++)
		if(prim(v[i])!=0)
			b[i]=v[i];
	afisare(b,n);
	std::cout<<"\n";
	return 0;
}
void citire(int v[MAX],int &m)
{
	int i,n;
	do
	{
		std::cout<<"n=";
		std::cin>>m;
	}while(m<1 || m>MAX);
	std::cout<<"dati elementele sirului:\n";
	for(i=0;i<m;i++)
	{
		std::cout<<"v["<<i<<"]=";
		std::cin>>v[i];
	}
}
void afisare(int v[MAX],int p)
{
	int i;
	std::cout<<"(";
	for(i=0;i<p;i++)
		std::cout<<v[i]<<" ";
	std::cout<<")\n";
}
int prim(int n)
{
	int j,p=1;
	for(j=1;j<=n-1;j++)
		if(n%j==0)
			p=0;
	return p;
}
